<template>
  <div class="box" id="quanxianZongheInfo">
    <div class="mainBox"> 
      <div class="leftBox">
        <div class="leftBox_title">
          抽查复核意见
        </div>
        <div class="leftBox_title_sub">
          <div class="leftBox_title_sub_piankuai leftBox_title_sub_text"><span>片块名：</span>{{landName}}</div>
          <div class="leftBox_title_sub_shijian leftBox_title_sub_text"><span>市级抽查复核时间：</span>{{time}}</div>
        </div>
        <div class="leftBox_title_sub">
          <div class="leftBox_title_sub_piankuai leftBox_title_sub_text"><el-checkbox v-model="checked1" disabled>复垦面积与竣工测绘成果是否一致</el-checkbox></div>
        </div>
        <div class="leftBox_title_sub">
          <div class="leftBox_title_sub_piankuai leftBox_title_sub_text"><el-checkbox v-model="checked2" disabled>复垦位置是否准确</el-checkbox></div>
        </div>
        <div class="leftBox_title_sub">
          <div class="leftBox_title_sub_piankuai leftBox_title_sub_text"><el-checkbox v-model="checked3" disabled>复垦质量是否达标</el-checkbox></div>
        </div>
        <div class="leftBox_line"></div>
        <div class="fujianBox">
          
          <div class="fujianList" v-if="imgArr.length!=0">
            <div class="fujianList_item" v-for="(item,index) in imgArr" :key="index">
              <div class="fujianList_item_left">{{item.name}}</div>
              <div class="fujianList_item_right" @click="btnSeeImg(item)">查看</div>
            </div>
          </div>
          <div class="fujianList fujianNoData" v-else>
            暂无数据
          </div>
        </div>
      </div>
      <div class="rightBox">
        <tdMap :zhjgList="zhjgList" class="mapBox_right" ref="tdMap" :pkList="mainDataData" :isShowControls="false" />
      </div>
    </div>
    <!-- <div class="landInfo">
      
      <div class="title">
        <p class="title_one">{{landName}}</p>
        <p class="title_little">
          <span>综合验收时间：{{time}}</span>
        </p>
      </div>
      <div class="project_position">
        <div class="project_title">综合验收结果</div>
        <div class="project_result">
          <div class="display_flex">
            <p>验收结果：</p>
            <el-checkbox v-model="checked" disabled>通过验收</el-checkbox>
          </div>
        </div>
      </div>
      <div class="project_position">
        <div class="project_title">综合验收现场位置及轨迹</div>
        <div class="project_img">
          <tdMap class="mapBox_right" ref="tdMap" :pkList="mainDataData" :isShowControls="false" />
        </div>
      </div>
      <div class="project_position">
        <div class="project_title">综合验收资料</div>
        <div class="project_img">
          <el-table :data="imgArr" border style="width: 100%">
            <el-table-column type="index" show-overflow-tooltip label="序号" width="60"></el-table-column>
            <el-table-column prop="name" label="类型" width="200"></el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="primary"
                  fixed="left"
                  @click="btnSeeImg(scope.row)"
                >查看</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
    </div> -->

    <el-dialog :close-on-click-modal="false" :title="title" :before-close="handleClose" :visible.sync="seeImgDialog" width="50%">
      <div class="seeImg">
        <div class="imgBox" style="width:500px;height:500px;margin:0 auto;" v-if="showImgType==1">
          <img style="width:100%;height:100%;" :src="$https+titlePath" alt="">
        </div>
        <div class="imgBox" style="width:700px;height:400px;margin:0 auto;" v-if="showImgType==2">
          <video id="showVedio" autoplay controls style="width:100%;height:100%;" :src="$https+titlePath"></video>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  supervisingInfo,
  supervisingCheck
} from "@/api/hegezhengPeihao";
import { getLandStatusMapAuditInfo } from "@/api/jjgc";
import tdMap from "@/components/tdMap";
import {selectLaterMultiPolygon} from "@/api/common";
export default {
  components: {
    tdMap
  },
  data() {
    return {
      //综合监管信息附件类型切换
      fujianType:1,
      checked1: '',
      checked2: '',
      checked3: '',
      flag: 1,
      options: [
        {
          value: "0",
          label: "全部"
        },
        {
          value: "1",
          label: "莲花村片区片块7-1"
        },
        {
          value: "2",
          label: "莲花村片区片块7-2"
        }
      ],
      value: "",
      tableData: [
        {
          date: "",
          name: "",
          address: ""
        },
        {
          date: "",
          name: "",
          address: ""
        }
      ],
      currentPage4: 4,
      title: "",
      titlePath: '',
      seeImgDialog: false,
      imgArr: [],


      dataArr:[],
      needInfo:{
        page:1,
        size:5
      },
      totalPage:0,
      landId:'',
      showImgType:null, //分辨视频图片

      isListLoading:false,
      mainDataData:[],

      landName:'',
      time:'',
      vcr:'',
      photo:'',
      zhjgList:[]
    };
  },
  created(){
    this.zhjgList.push(JSON.parse(localStorage.getItem("zongheItem")))
    this.landName=this.$route.query.landName
    this.time=this.$route.query.time
    this.landId=this.$route.query.id
    //this.vcr=this.$route.query.vcr
    //this.photo=this.$route.query.photo
    this.getDetaile(this.$route.query.photo, this.$route.query.vcr)
    this.getInfo(this.$route.query.id)
    this.getData()
  },
  methods: {
    getInfo(landId){
      let obj={
        page:1,
        size:10,
        projectId:localStorage.getItem("projectId"),
        landId:landId,
      }
      supervisingInfo(obj).then(res=>{
        let data=res.data.rows[0]
        this.checked1=data.ifmjxd=="YES"?true:(data.ifmjxd=="NO"?false:'')
        this.checked2=data.ifwzzq=="YES"?true:(data.ifmjxd=="NO"?false:'')
        this.checked3=data.iffkzl=="YES"?true:(data.ifmjxd=="NO"?false:'')
      })
    },
    //切换附件类型事件
    changeFujianType(type){
      this.fujianType=type
    },
    handleClose(){
      this.seeImgDialog=false
      var vedio=document.getElementById("showVedio")
      vedio.currentTime = 0
      vedio.pause()
    },
    
    getData(){
      var data1={
        landId:this.landId,
      }
      selectLaterMultiPolygon(data1).then(res=>{
        let obj=res.data
        let array=[]
        array.push(obj)
        this.mainDataData=array
      })
      
    },
    getDetaile(photo,vcr){
      var obj={
        page:1,
        size:10,
        photo:photo,
        vcr:vcr
      }
      supervisingCheck(obj).then(res=>{
        console.log(res,'监管详情')
        var imageGeShi=["bmp","pcx","png","jpg","jpeg","gif","tiff"]
        var videoGeShi=["mp4","avi","flv","rmvb","mkv","gif","mov","rm","3gp"]
        var mainList=[]
        var mainList1=[]
        res.data.rows.forEach((item,index)=>{
          imageGeShi.forEach(item1=>{
            if(item.fileKey.substring(item.fileKey.indexOf('.')+1,item.fileKey.length)==item1){
              var index=item.fileKey.indexOf(".")
              var photoType=item.fileKey.substring(index,item.fileKey.length) 
              mainList.push({name:'外业核查照片',path:item.filePath,type:1,flieType:photoType})
            }
          })
        })
        res.data.rows.forEach((item,index)=>{
          videoGeShi.forEach(item1=>{
            if(item.fileKey.substring(item.fileKey.indexOf('.')+1,item.fileKey.length)==item1){
              var index=item.fileKey.indexOf(".")
              var vedioType=item.fileKey.substring(index,item.fileKey.length) 
              mainList1.push({name:'核查现场视频',path:item.filePath,type:2,flieType:vedioType})
            }
          })
        })
        //名称处理
        mainList.forEach((item,index)=>{
          item.name=item.name+(index!=0?index:'')+item.flieType
        })
        mainList1.forEach((item,index)=>{
          item.name=item.name+(index!=0?index:'')+item.flieType
        })
        this.imgArr=mainList.concat(mainList1)

      })
    },
    btnSeeImg(row) {
      this.title = row.name;
      this.titlePath = row.path
      this.showImgType = row.type
      this.seeImgDialog = true;
      var vedio=document.getElementById("showVedio")
      vedio.play()
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    }
  }
};
</script>

<style lang="scss" scoped>
.box {
  padding: 30px 40px;
  box-sizing: border-box;
 
}
.display_flex {
  display: flex;
  align-items: center;
}
.box_search .display_flex p {
  font-size: 14px;
  color: #333333;
}
.margin_rignt {
  margin-right: 30px;
}
.table {
  margin: 20px 0px;
}

.landInfo {
  border: 1px solid #efefef;
  box-sizing: border-box;
}
.back {
  margin: 20px;
}
.title_one {
  text-align: center;
  line-height: 40px;
  font-size: 20px;
  color: #444;
  font-weight: bold;
}
.title_little {
  font-size: 13px;
  color: #999;
  margin: 40px 20px 20px 30px;
}
.title .title_little span {
  margin-right: 30px;
}
.project_title {
  background: #f8f8f8;
  height: 50px;
  background: #f8f8f8;
  padding: 0px 30px;
  line-height: 50px;
  color: #48494d;
  font-size: 14px;
  font-weight: bold;
  border-top: 1px solid #efefef;
  border-bottom: 1px solid #efefef;
}
.project_img {
  padding: 30px;
}
.seeImg {
  text-align: center;
}
.project_result {
  padding: 30px;
}
.project_result .display_flex {
  margin-bottom: 20px;
  font-size: 13px;
  color: #444;
  width: 180px;
}
.project_result .display_flex p {
  font-size: 14px;
  color: #444444;
  font-weight: bold;
}
#quanxianZongheInfo /deep/ .el-checkbox__input.is-disabled+span.el-checkbox__label{
  border-color: #409EFF;
}
#quanxianZongheInfo /deep/ .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner{
  border-color: #409EFF;
background-color: #409EFF;
}
#quanxianZongheInfo /deep/ .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner::after{
  border-color: #fff;
}
#quanxianZongheInfo /deep/ .el-checkbox__input.is-disabled+span.el-checkbox__label{
  color: #12203e;
}
.pages{
  text-align: center;
}

.mainBox{
  width: 100%;
  display: flex;
 height: calc(100vh - 174px);
}
.leftBox{
  width: 30%;
  margin-right: 5%;
}
.leftBox_title{
  color: #4D4D4D;
  font-size:18px;
  font-weight:bold;
  line-height:25px;
}
.leftBox_title_sub{
  display: flex;
  align-items: center;
  margin-top: 20px;
  margin-bottom: 20px;
}
.leftBox_title_sub .leftBox_title_sub_piankuai{
  margin-right: 40px;
}
.leftBox_title_sub .leftBox_title_sub_text{
  color: #595959;
  font-size: 14px;
}
.leftBox_title_sub_text span{
  color: #737373;
}
.leftBox_line{
  height:1px;
  background:rgba(235,238,245,1);
  opacity:1;
  margin-top: 30px;
  margin-bottom: 14px;
}
.fujianBox_tabs{
  display: flex;
  align-items: center;
}
.fujianBox_tabs_item{
  width:60px;
  height:28px;
  background:#F0F3F5;
  opacity:1;
  border-radius:2px;
  color: #696969;
  font-size: 14px;
  margin-right: 8px;
  text-align: center;
  line-height: 28px;
  cursor: pointer;
}
.fujianBox_tabs_item.on{
  background:#409EFF;
  color: #fff;
}
.fujianList{
  margin-top: 14px;
}
.fujianList_item{
  width: 100%;
  display: flex;
  justify-content: space-between;
  height: 56px;
  line-height: 56px;
}
.fujianList_item .fujianList_item_left{
  color: #606266;
  font-size: 14px;
}
.fujianList_item .fujianList_item_right{
  color: #409EFF;
  font-size: 14px;
  cursor: pointer;
}
.rightBox{
  width: 70%;
}
.fujianNoData{
  text-align: center;
  margin-top: 50px;
  letter-spacing: 8px;
  color: #696969;
}
</style>